<template>
  <div class="waiting-info">
    <div class="list-item-setting">
      <div class="title-info">
        <el-divider content-position="left">列表区域设置</el-divider>
      </div>

      <template v-if="optionsInfo['consultingShown']">
        <el-form-item label="标题文案">
          <el-input
            v-model="optionsInfo['consultingWork']"
            size="small"
            class="hide-spin-button"
          />
        </el-form-item>
        <el-form-item label="标题文字大小">
          <el-input-number
            v-model="optionsInfo['consultingFontSize']"
            size="small"
            class="hide-spin-button"
          />
        </el-form-item>
        <el-form-item label="标题字体颜色">
          <el-color-picker
            size="small"
            show-alpha
            :predefine="predefineColors"
            v-model="optionsInfo['headerFontColor']"/>
        </el-form-item>
      </template>

      <el-form-item label="展示行数">
        <el-input-number
          :min="11"
          :max="20"
          size="small"
          @change="handleTotal"
          class="hide-spin-button"
          v-model="optionsInfo.showRowNums"
        />
      </el-form-item>

      <el-form-item label="内容高度">
        <el-input-number
          :min="0"
          size="small"
          class="hide-spin-button"
          v-model="optionsInfo.areaHeight"
        />
      </el-form-item>


      <template v-if="false">
        <el-form-item label="是否切页">
          <el-switch v-model="optionsInfo['switchState']"/>

        </el-form-item>

        <el-form-item label="切页时间(s)">
          <el-input-number
            :min="10"
            size="small"
            class="hide-spin-button"
            v-model="optionsInfo.switchTime"
          />
        </el-form-item>
      </template>

    </div>

    <div class="list-title-setting">
      <div class="title-info">
        <el-divider content-position="left">列表设置</el-divider>
      </div>
      <el-form-item class="column-info">
        <div class="options-info row-option">
          <el-checkbox-group v-model="optionsInfo['defaultShowCol']">
            <template v-if="false">
              <Draggable
                class="list-group"
                @end="handleDragEnd"
                :list="optionsInfo['waitColOption']"
                :animation="100"
              >
                <el-checkbox
                  v-for="(item,index) in (optionsInfo['waitColOption'])"
                  :key="index"
                  :label="item.value"
                  :disabled="isDisabled(item.value)"
                >
                  <div class="setting-info">
                    <el-input v-model="item.label" placeholder="请输入内容" size="small"/>
                    <el-input
                      type="number"
                      :min="0.1"
                      :max="7"
                      :step="0.1"
                      :precision="1"
                      @change.native.prevent="(e)=>handleChangeWidth(e)"
                      v-model="item.flex" placeholder="请输入列宽" size="small"/>
                  </div>
                  <i class="el-icon-thumb" v-if="false"/>
                </el-checkbox>
              </Draggable>
            </template>
            <template v-if="true">
              <el-checkbox
                v-for="(item,index) in (optionsInfo['waitColOption'])"
                :key="index"
                :label="item.value"

              >
                <!--                :disabled="isDisabled(item.value)"-->
                <div class="setting-info">
                  <el-input v-model="item.label" placeholder="请输入内容" size="small"/>
                  <el-input
                    :max="7"
                    :min="0.1"
                    :step="0.1"
                    :precision="1"
                    type="number"
                    v-model="item.flex" placeholder="请输入列宽" size="small"/>
                </div>
                <i class="el-icon-thumb" v-if="false"/>
              </el-checkbox>
            </template>
          </el-checkbox-group>
        </div>
      </el-form-item>

      <div class="title-info">
        <el-divider content-position="left">患者字体设置(上方)</el-divider>
      </div>
      <el-form-item label="选中患者字体颜色" class="column-info">
        <el-color-picker
          size="small"
          show-alpha
          :predefine="predefineColors"
          v-model="optionsInfo['fontColor']"/>
      </el-form-item>
      <el-form-item label="字号设置">
        <el-input-number
          v-model="optionsInfo['fontSize']"
          :min="12"
          size="small"
          class="hide-spin-button"
        />
      </el-form-item>
      <el-form-item label="粗细设置">
        <el-select v-model="optionsInfo['fontWeight']" placeholder="请选择">
          <el-option
            v-for="item in fontWeightOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>

    </div>

    <div class="list-title-setting">
      <div class="title-info">
        <el-divider content-position="left">患者字体设置(下方)</el-divider>
      </div>
      <el-form-item label="选中患者字体颜色" class="column-info">
        <el-color-picker
          size="small"
          show-alpha
          :predefine="predefineColors"
          v-model="optionsInfo['callPatientFontColor']"/>
      </el-form-item>
      <el-form-item label="字号设置">
        <el-input-number
          v-model="optionsInfo['callPatientFontSize']"
          :min="12"
          size="small"
          class="hide-spin-button"
        />
      </el-form-item>
      <el-form-item label="粗细设置">
        <el-select v-model="optionsInfo['callPatientFontWeight']" placeholder="请选择">
          <el-option
            v-for="item in fontWeightOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>
    </div>
  </div>
</template>

<script>
import constantDic from "@/utils/vue-i18n/lang/zh-CN";
import Draggable from "vuedraggable"
import roomNameKeyEditor
  from "@sc/templateDetails/modules/homeRight/property-editor/module/scene-edit/basicInfo/roomNameKey-editor.vue";
import * as types from "@c/public/form-designer/devType/datas-types";
import {fontWeightOptions} from "@c/public/form-designer/devType/datas-types";
import Template from "@sc/template/index.vue";

export default {
  name: "sceneWaitingCallPatientConfig-editor",

  componentName: "sceneWaitingCallPatientConfig-editor",

  components: {
    Template,
    roomNameKeyEditor,
    Draggable
  },

  mixins: [],

  props: {
    designer: Object,
    selectedWidget: Object,
    optionModel: Object,
  },

  inject: ['serverFieldList', 'getDesignerConfig'],

  data() {
    return {
      constantDic: constantDic,
      optionsInfo: Object(),
      predefineColors: types['predefineColors'],
      fontWeightOptions:types['fontWeightOptions'],
    }
  },

  computed: {
    isDisabled() {
      return function (val) {
        return true;
      }
    }
  },

  methods: {
    handleDragEnd() {},

    handleTotal(val) {
      let {multiple} = (this.optionsInfo)
      Reflect.set((this.optionsInfo),'total',(multiple * val));
    }
  },


  watch: {
    // 组件的所有信息
    optionModel: {
      handler: function (val) {
        let key = val.config
        this.optionsInfo = val[key];
      },
      deep: true,
      immediate: true
    }
  }
}
</script>

<style lang="scss" scoped>
.column-info {
  display: flex;
  flex-direction: column;

  :deep(.el-form-item__label) {
    width: 100% !important;
  }

  :deep(.el-form-item__content) {
    width: 100% !important;
    margin-left: 0 !important;

    .el-checkbox-group {
      display: flex;
      flex-direction: column;
    }

    .list-group {
      width: 100%;
    }
  }
}

.row-option {
  :deep(.el-checkbox) {
    display: flex;
    flex-direction: row;
    margin-right: 0 !important;

    .el-checkbox__input {
      display: flex;
      align-self: flex-start;
      align-items: flex-start;
    }

    .el-checkbox__label {
      display: flex;
      flex-direction: row;
      width: 100%;

      .setting-info {
        display: flex;
        width: 100%;
        flex-direction: column;

        .el-input {
          width: 100%;
          margin-bottom: 20px;

          input[type="number"] {
            line-height: 1px !important;
          }
        }

        .el-input-number {
          width: 100%;
        }

        .el-input__inner {
          padding-right: 0 !important;
        }
      }
    }
  }
}
</style>
